package com.shop.user.controller.WeChat;

import com.shop.entity.dto.WeChatOrders.UserOrdersSaveDto;
import com.shop.entity.vo.OrdersVo;
import com.shop.user.service.OrdersService;
import com.shop.utils.common.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/orders")
@Slf4j
public class OrdersController {

    @Autowired
    private OrdersService ordersService;

    @PostMapping("save_orders")
    public Result addOrders(@RequestBody UserOrdersSaveDto dto){
        log.info("微信小程序-添加订单");
        return ordersService.addOrders(dto);
    }

    @GetMapping("get_orders")
    public Result<List<OrdersVo>> getOrders(){
        log.info("微信小程序-用户订单显示");
        return ordersService.getUserOrders();
    }

}
